#![windows_subsystem = "windows"]

use std::time::Duration;
use tokio::time::sleep;
use tracing::error;

mod log;
mod config;
mod message;
mod notification;
mod http;
mod utils;

pub const CODE_ACTIVE_KEY: &'static str = "Medisoftware.ACMT";
pub const SERVICE_CONNECT_URL: &'static str = "https://sse.slitme.com/sse/connect";
// pub const SERVICE_CONNECT_URL: &'static str = "http://192.168.0.46:8118/sse/connect";
pub const ICON_PATH: &[u8] = include_bytes!("../icon/h4g2v-2ejv3-001.ico");

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // 初始化日志
    log::tracing_init()?;

    utils::register_app_id()?;
    loop {
        tokio::spawn(async {
            http::connect_sse(SERVICE_CONNECT_URL).await
        }).await??;
        error!("链接错误，重试结束，等待10分钟后重试！");
        sleep(Duration::from_secs(600)).await;
    }
}
